Skip to content

Running windows programs under litebox on linux#712

Open
Vadiml1024 wants to merge 675 commits intomicrosoft:mainfrom
Vadiml1024:main
Open

Running windows programs under litebox on linux#712
Vadiml1024 wants to merge 675 commits intomicrosoft:mainfrom
Vadiml1024:main

Conversation

@Vadiml1024
Copy link

This PR extends Microsoft's LiteBox library OS with a new Windows-on-Linux execution capability — the inverse of the upstream Linux-on-Windows feature. Key additions include:

litebox_shim_windows — a PE/COFF parser with full header validation, section loading, relocation (DIR64/ASLR) support, and comprehensive error handling.
litebox_platform_linux_for_windows — a Linux platform abstraction layer for future Windows binary execution.
litebox_runner_windows_on_linux_userland — a CLI runner for inspecting and executing Windows PE binaries on Linux.
C++ exception handling infrastructure for Windows-on-Linux (WIP).
A GitHub Actions workflow to automate opening PRs back to the upstream microsoft/litebox repository.

Vadiml1024 and others added 30 commits February 22, 2026 13:33
…nux-support-again

Phase 22: Reduce Windows-on-Linux stub count 22→14
Co-authored-by: Vadiml1024 <917273+Vadiml1024@users.noreply.github.com>
Co-authored-by: Vadiml1024 <917273+Vadiml1024@users.noreply.github.com>
…per review

Co-authored-by: Vadiml1024 <917273+Vadiml1024@users.noreply.github.com>
…s doc and instructions

Co-authored-by: Vadiml1024 <917273+Vadiml1024@users.noreply.github.com>
…-support-again

Phase 23: Eliminate all remaining Windows-on-Linux stubs
Co-authored-by: Vadiml1024 <917273+Vadiml1024@users.noreply.github.com>
…tatus

docs: remove duplicate content from windows_on_linux_status.md
Co-authored-by: Vadiml1024 <917273+Vadiml1024@users.noreply.github.com>
Consolidate CI and other workflows into ci.yml
Co-authored-by: Vadiml1024 <917273+Vadiml1024@users.noreply.github.com>
…inux-support-another-one

Phase 24: Extended USER32 + new GDI32 headless stubs for GUI program support
…VERSION.dll support

- Add SystemTime struct and GetSystemTime/GetLocalTime using libc gmtime_r/localtime_r
- Add SystemTimeToFileTime/FileTimeToSystemTime for FILETIME conversion
- Add GetTickCount (32-bit wrapper around GetTickCount64)
- Add LocalAlloc/LocalFree delegating to HeapAlloc/HeapFree
- Add InterlockedIncrement/Decrement/Exchange/ExchangeAdd/CompareExchange/CompareExchange64
- Add IsWow64Process (always returns TRUE with is_wow64=FALSE)
- Add GetNativeSystemInfo (delegates to GetSystemInfo)
- Promote AtomicI32/AtomicI64/Ordering to module-level imports in kernel32.rs
- Add shell32.rs: CommandLineToArgvW, SHGetFolderPathW, ShellExecuteW, SHCreateDirectoryExW
- Add version.rs: GetFileVersionInfoSizeW, GetFileVersionInfoW, VerQueryValueW (stubs)
- Register all new functions in function_table.rs and dll.rs
- Update test_dll_manager_creation to expect 12 DLLs (SHELL32 + VERSION added)
- 384 tests passing (up from 367 in Phase 24)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…move non-standard CSIDL_TEMP)

Co-authored-by: Vadiml1024 <917273+Vadiml1024@users.noreply.github.com>
…ator, LocalFree return, E_FAIL constant, SystemTimeToFileTime validation

Co-authored-by: Vadiml1024 <917273+Vadiml1024@users.noreply.github.com>
…inux-support-yet-again

Phase 25: Time APIs, interlocked ops, SHELL32.dll, VERSION.dll
…r name APIs

- Add CreateMutexW/A, OpenMutexW, ReleaseMutex
- Add CreateSemaphoreW/A, OpenSemaphoreW, ReleaseSemaphore
- Add WaitForSingleObject/WaitForMultipleObjects support for mutex/semaphore handles
- Add SetConsoleMode, SetConsoleTitleW/A, GetConsoleTitleW
- Add AllocConsole, FreeConsole, GetConsoleWindow
- Add lstrlenA, lstrcpyW/A, lstrcmpW/A, lstrcmpiW/A
- Add OutputDebugStringW/A
- Add GetDriveTypeW, GetLogicalDrives, GetLogicalDriveStringsW
- Add GetDiskFreeSpaceExW, GetVolumeInformationW
- Add GetComputerNameW/ExW
- Add GetUserNameW/A (ADVAPI32)
- Update function_table.rs and dll.rs exports
- Update ratchet.rs global count from 39 to 42
- Fix pre-existing clippy cast_signed issue in shell32.rs

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Use 'needed' variable (instead of utf16.len() + 1) for consistency in GetUserNameW size assignment
- Keep libc import clean (use 'use libc;' form consistently)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…Computer Name APIs

Co-authored-by: Vadiml1024 <917273+Vadiml1024@users.noreply.github.com>
…ame consistency

Co-authored-by: Vadiml1024 <917273+Vadiml1024@users.noreply.github.com>
…inux-support-one-more-time

Phase 26: Mutex/Semaphore, Console, String, Drive/Volume, and Identity APIs
Add thread management, file times, character APIs, window utilities,
system directory paths, and temp file name generation.

KERNEL32 additions (15 functions):
- SetThreadPriority / GetThreadPriority (no-op, always normal priority)
- SuspendThread / ResumeThread (no-op, always returns 0)
- OpenThread (looks up handle in THREAD_HANDLES registry)
- GetExitCodeThread (returns STILL_ACTIVE or actual exit code)
- OpenProcess (returns pseudo-handle for current process only)
- GetProcessTimes (returns wall-clock creation time, zero CPU times)
- GetFileTime (reads fstat timestamps for open file handles)
- CompareFileTime (three-way comparison of FILETIME values)
- FileTimeToLocalFileTime (applies local timezone offset)
- GetSystemDirectoryW (returns C:\Windows\System32)
- GetWindowsDirectoryW (returns C:\Windows)
- GetTempFileNameW (generates unique temp file name with prefix)

USER32 additions (15 functions):
- CharUpperW / CharLowerW (in-place or single-char wide conversion)
- CharUpperA / CharLowerA (in-place or single-char ANSI conversion)
- IsCharAlphaW / IsCharAlphaNumericW / IsCharUpperW / IsCharLowerW
- IsWindow / IsWindowEnabled / IsWindowVisible (headless: always FALSE)
- EnableWindow / GetWindowTextW / SetWindowTextW / GetParent (headless stubs)

Also updates function_table.rs and dll.rs with all new exports.
Adds 27 new unit tests covering all new functions.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Use wrapping_add/wrapping_mul in GetProcessTimes for explicit overflow behavior
- Use i128 intermediate cast in FileTimeToLocalFileTime to avoid i64 overflow
  for extreme timezone offsets, then reinterpret as u64 for wrapping_add

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Vadiml1024 and others added 29 commits March 4, 2026 20:32
…-apis

Phase 45: Windows GUI APIs (USER32/GDI32), Vulkan-1 stubs, and C GUI test program
…kages, ratchet update

Co-authored-by: Vadiml1024 <917273+Vadiml1024@users.noreply.github.com>
… improve docs

Co-authored-by: Vadiml1024 <917273+Vadiml1024@users.noreply.github.com>
…ading test

Co-authored-by: Vadiml1024 <917273+Vadiml1024@users.noreply.github.com>
…upport

Add `real_vulkan` feature for pass-through to host Vulkan ICD loader
Co-authored-by: Vadiml1024 <917273+Vadiml1024@users.noreply.github.com>
Co-authored-by: Vadiml1024 <917273+Vadiml1024@users.noreply.github.com>
…lure

Co-authored-by: Vadiml1024 <917273+Vadiml1024@users.noreply.github.com>
Co-authored-by: Vadiml1024 <917273+Vadiml1024@users.noreply.github.com>
Co-authored-by: Vadiml1024 <917273+Vadiml1024@users.noreply.github.com>
Integrate C Windows GUI API test program into CI workflow
Co-authored-by: Vadiml1024 <917273+Vadiml1024@users.noreply.github.com>
Co-authored-by: Vadiml1024 <917273+Vadiml1024@users.noreply.github.com>
Co-authored-by: Vadiml1024 <917273+Vadiml1024@users.noreply.github.com>
sync-branch: rebase local main onto upstream and auto-resolve conflicts
…orkflow

chore: trigger sync-branch workflow
- Merge upstream/main into fork with fork's code winning conflicts
- Rename change_address_space() back to load() for upstream compatibility
- Add clean_up() and new_user_page_table() methods for user_context support
- Add user_context module declaration and imports
- Remove duplicate NtdllApi impl and imports in linux_for_windows
- Fix stale modular_bitfield imports in optee
- Fix duplicate imports in linux_kernel
- Update ratchet counts for upstream changes
- Create docs/rebasing.md with detailed conflict log

Co-authored-by: Vadiml1024 <917273+Vadiml1024@users.noreply.github.com>
- litebox_platform_linux_userland/src/lib.rs: Fix CoW region overlap
  check to also detect when a previous region extends into the new range
- litebox_common_linux/src/loader.rs: Use checked_add for trampoline
  offset validation to prevent overflow with malformed ELF inputs
- litebox_rtld_audit/rtld_audit.c: Harden align_up against zero alignment
  and overflow; validate max_addr before pointer arithmetic to prevent
  invalid trampoline address computation

Co-authored-by: Vadiml1024 <917273+Vadiml1024@users.noreply.github.com>
Merge microsoft/litebox upstream main into fork with conflict resolution
Merge signal infrastructure and SIGINT support from copilot/rebase-on-microsoft-main
@Vadiml1024
Copy link
Author

@microsoft-github-policy-service agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants